// pages/home/home.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    jiaRuNum: {
      type: String,
      value: '已有999位宝妈加入计划'
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
    indicatorDots: true,
    vertical: false,
    autoplay: false,
    interval: 2000,
    duration: 500,
    imgPath: '/images',
    listData: [],

    //是否加入计划前
    beforePlanned:false,
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onChange(e) {
      const {
        detail: {
          current,
          source
        },
      } = e;
      // console.log(current, source);
    },
    /**
     * 了解魔杰龙
     * @param {*} e 
     */
    onMjl(e) {

      wx.navigateTo({
        url: '/pages/home/ljmjl',
      })
    },
    join(){
      wx.navigateTo({
        url: '/pages/plan/joinPlan',
      })
    },
    buy(){
      wx.navigateTo({
        url: '/pages/goods/detail',
      })
    },
    /**
     * 分享
     */
    share(){

     wx.navigateTo({
      url:'/pages/projects/projects',
     });

    },
  },
  lifetimes: {
    attached() {
      //页面标题
      wx.setNavigationBarTitle({
        title: "首页"
      })

      //图片路径
      const util = require("../../utils/util")
      this.setData({
        imgPath: util.getImgPath()
      })

      //是否加入计划前
      this.setData({
        beforePlanned:util.getBeforePlanned()
      })

      //商品列表
      this.data.listData.push({
        imgSrc: this.data.imgPath + '/home/goods1.png',
        content: 'MAGIC DRAGON魔杰龙轻柔倍适纸尿裤'
      })
      this.data.listData.push({
        imgSrc: this.data.imgPath + '/home/goods1.png',
        content: 'MAGIC DRAGON魔杰龙轻柔倍适纸尿裤'
      })
      //刷新数据
      this.setData({
        listData: this.data.listData
      })
      // console.log("this.data.listData", this.data.listData)
    }
  }
})